﻿
-- 新增分包并返回
create procedure [dbo].[Packageinfo_AddReturn]
@fbfid varchar(20)=null,
@fbmc varchar(20),
@bz varchar(20)
as
declare @fbid varchar(20)
select @fbid=max(fbid) from Fenb_Info where (@fbfid is null or fbfid=@fbfid)
if(@fbfid is null and @fbid is null)
begin
	set @fbid='01'
end
else
begin
	set @fbid=isnull(@fbfid,'')+isnull(right('00'+convert(varchar,right(@fbid,2)+1),2),'01')
end
insert into Fenb_Info values(@fbid,@fbfid,@fbmc,@bz)
select * from Fenb_Info where fbid=@fbid